package com.mgq.design.strategy.c2;

/**
 * <b>功能：</b>Client类<br>
 * <b>Copyright TCSL</b>
 * <li>版本&nbsp;&nbsp;&nbsp;&nbsp;修改日期&nbsp;&nbsp;&nbsp;&nbsp;部　　门&nbsp;&nbsp;&nbsp;&nbsp;作　者&nbsp;&nbsp;&nbsp;&nbsp;变更内容</li><hr>
 * <li>v1.0&nbsp;&nbsp;&nbsp;&nbsp;20220415&nbsp;&nbsp;营业后台&nbsp;&nbsp;&nbsp;&nbsp;马广奇&nbsp;&nbsp;&nbsp;&nbsp;创建类</li>
 * <br><br>
 *
 * @author 马广奇
 * @version 2022-04-15 14:26
 */
public class Client {
    public static void main(String[] args) {
        boolean isNumber = new Validator(new IsNumeric()).validate("sss");
        System.out.println(isNumber);
        boolean IsAllLowerCase = new Validator(new IsAllLowerCase()).validate("sss");
        System.out.println(IsAllLowerCase);

        //直接使用lambda表达式,简化实现类
        Validator numberValidator = new Validator(s -> s.matches("\\d+"));

        Validator allLowerCaseValidator = new Validator(s -> s.matches("[a-z]+"));


        boolean isNumber1 = numberValidator.validate("sss");
        boolean isAllLowerCase1 = allLowerCaseValidator.validate("sss");
        System.out.println(isNumber1);
        System.out.println(isAllLowerCase1);
    }
}
